import { Space,Radio } from "antd";
import { FC } from "react";
import {Typography} from "antd";
const {Title} = Typography
type optionType_radio = {
    text:string,
    value:string
}

export type questionRadio_propsType = {
    title?:string,
    options?:optionType_radio[]
    default_option?:string
    isverticle?:boolean,
    islock?:boolean,
    onchange?:(newprops:questionRadio_propsType)=>void
}

export const questionRadio_defaultValue:questionRadio_propsType = {
    title:'用户多选框',
    options:[
        {text:'选项1',value:'111'},
        {text:'选项2',value:'222'},
        {text:'选项3',value:'333'}
    ],
    default_option:'111'
}
const QuestionRadio:FC<questionRadio_propsType> = (props)=>{
    const {title,options,default_option,isverticle} = props
    return <>
    <Space direction='vertical'>
        <Title level={3}>{title}</Title>
        <Radio.Group  value={default_option} >
           <Space direction={isverticle ? 'vertical' : 'horizontal'}>
            {options?.map((item,index)=>{
                    return <Radio key={index} value={item.value}>{item.text}</Radio>
                })}
           </Space>
        </Radio.Group>
    </Space>
    
    </>
}

export default QuestionRadio